package com.gmail.dmitryustimov.ms.java7.visitor.mod_reflective.example.example1;

/**
 * Author: Dmitry Ustimov
 * Date: 5/10/13
 * Time: 10:35 AM
 */
public class ExtendCalculationVisitor extends CalculationVisitor {
    protected void evaluate(Variable var) {
        result = var.getValue();
    }
    protected void evaluate(Assignment expr) throws NoSuchMethodException {
        Expression lvalue = expr.getLvalue();
        Expression rvalue = expr.getRvalue();
        visit(rvalue);
        if ( lvalue instanceof Variable);
        ((Variable)lvalue).setValue(result);
    }
}
